#ifndef QUAD_H
#define QUAD_H

#include "hittable.h"
#include "hittableList.h"

class Quad : public Hittable
{
public:
    Quad(const Point3& Q, const Vec3& u, const Vec3& v, std::shared_ptr<Material> mat);

    virtual void set_bounding_box();

    AABB bounding_box() const override { return bbox; }

    bool hit(const Ray& r, Interval ray_t, HitRecord& rec) const override;

    virtual bool is_interior(double a, double b, HitRecord& rec) const;

    double pdf_value(const Point3& origin, const Vec3& direction) const override;
    Vec3 random(const Point3& origin) const override;
private:
    Point3 Q;
    Vec3 u, v;
    Vec3 w;
    std::shared_ptr<Material> mat;
    AABB bbox;
    Vec3 normal;
    double D;
    double area;
};

std::shared_ptr<HittableList> box(const Point3& a, const Point3& b, shared_ptr<Material> mat);
#endif